<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  var str = '18502762585';

  console.log(str.substr(0, 3) + '****' + str.substr(7));

  var a = str.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');//返回新的字符串;
  console.log(a);
</script>
</body>
</html>